#pragma once
#include "Runtime/Base/Object.h"
namespace Alice{
    class World;
    struct FRegisterComponentContext
    {
        
    };
    class ActorComponent:public Object{
    public:
        bool mbRegistered:1;
        bool mbAutoRegister:1;
        bool mbHasBeenCreated:1;
        bool mbRenderStateCreated:1;
        /** Is this component in need of its whole state being sent to the renderer? */
        uint8 mbRenderStateDirty:1;
        /** Is this component's transform in need of sending to the renderer? */
        uint8 mbRenderTransformDirty:1;
        /** Is this component's dynamic data in need of sending to the renderer? */
        uint8 mbRenderDynamicDataDirty:1;
        /** Is this component's instanced data in need of sending to the renderer? */
        uint8 mbRenderInstancesDirty:1;
        World* mWorldPrivate;
        
        ActorComponent();
        virtual World* GetWorld() const{return mWorldPrivate;}
        void RegisterComponent();
        void UnregisterComponent();
        void ExecuteRegisterEvents(FRegisterComponentContext* Context = nullptr);
        virtual void OnRegister();
        virtual void OnComponentCreated();
        void MarkRenderTransformDirty();
        void MarkForNeededEndOfFrameUpdate();
        void RegisterComponentWithWorld(World* InWorld, FRegisterComponentContext* Context = nullptr);
        /** 
         * Used to create any rendering thread information for this component
         * @warning This is called concurrently on multiple threads (but never the same component concurrently)
         */
        virtual void CreateRenderState_Concurrent(FRegisterComponentContext* Context);
        /** 
         * Called to send a transform update for this component to the rendering thread
         * @warning This is called concurrently on multiple threads (but never the same component concurrently)
         */
        virtual void SendRenderTransform_Concurrent();
        /** Called to send dynamic data for this component to the rendering thread */
        virtual void SendRenderDynamicData_Concurrent();
        /** Called to send instance data for this component to the rendering thread */
        virtual void SendRenderInstanceData_Concurrent();
        /** 
         * Used to shut down any rendering thread structure for this component
         * @warning This is called concurrently on multiple threads (but never the same component concurrently)
         */
        virtual void DestroyRenderState_Concurrent();
        void DoDeferredRenderUpdates_Concurrent();
        virtual void TickComponent(float DeltaTime, enum ELevelTick TickType);
    };
}